﻿<%@ Page Title="CUPS Housing" Language="vb" AutoEventWireup="false" MasterPageFile="~/Content/Site.Master" CodeBehind="housing.aspx.vb" Inherits="CupsApp.Web.Form.housing" %>
<%@ Register assembly="wwDataBinder" namespace="MsdnMag.Web.Controls" tagprefix="ww" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link type="text/css" href="../Content/Styles/jquery-ui-1.7.2.custom.css" rel="stylesheet" />
    <script src="../Content/Scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script src="../Content/Scripts/jquery-ui-1.7.2.custom.min.js" type="text/javascript"></script>
	<script type="text/javascript">
	$(function() {
		$(".datepicker").datepicker();
	});
	</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="tabs">
 <div class="tab"><asp:LinkButton ID="lnkPersonal" Text = "Personal" runat="server" ></asp:LinkButton></div> <div class="tab"><asp:LinkButton ID="lnkBackground"  Text="Background" runat="server"></asp:LinkButton></div> <div class="tab"><asp:LinkButton ID="lnkHealthLegal" Text = "Health / Legal" runat="server"></asp:LinkButton></div> 
 <div class="tabSelected"><asp:LinkButton ID="lnkHousing" Enabled="false" Text = "Housing" runat="server"></asp:LinkButton></div><div class="tab"><asp:LinkButton ID="lnkFollowUp" Text = "Follow-Up" runat="server"></asp:LinkButton></div><div class="tab"><asp:LinkButton ID="lnkStatus" Text = "Status" runat="server"></asp:LinkButton></div><div class="tab"><asp:LinkButton ID="lnkExit" Text = "Exit" runat="server"></asp:LinkButton></div>
</div>

<div class="Content">
<div class="FullRow1">
     <div class="FormHeading">
         <strong><asp:Label ID="Label6" runat="server" Text="SELECTED CLIENT"></asp:Label></strong>
    </div>
  </div>
<asp:FormView ID="FormView1" runat="server" DataSourceID="ObjectDataSource4" 
        Width="100%"> 
        <ItemTemplate >
        <b>First Name:</b><i><%# Eval("FirstName") %></i><br />
        <b>Last Name:</b> <i><%# Eval("LastName") %></i><br />
        <b>Phone No:</b> <i><%# Eval("Phone") %></i><br />
        <b>Email:</b> <i><%# Eval("Email") %></i><br />
        <b>Birth Date:</b> <i><%# Eval("BirthDate") %></i><br />
        </ItemTemplate>   
  </asp:FormView>
<div class="filler">
         <center> <strong><asp:Label ID="lvlMsg" runat="server" ForeColor="#00CC00" ></asp:Label></strong></center></div><div class="filler"></div>
   <div class="FullRow1">
 
     <div class="FormHeading">
         <strong><asp:Label ID="lblBasicInfo" runat="server" Text="LANDLORD INFO"></asp:Label></strong>
    </div>
  </div> 
  <div class="filler"></div>
   <div class="FullRow1">
    <div class="ContentRow2">
    </div>
    <div class="ContentRow1">
        <asp:Label ID="Label4" runat="server" Text="Term Lease Date From:"></asp:Label>
    </div>
    <div class="ContentRow2">
        <asp:TextBox ID="txtFromDate" CssClass="datepicker" runat="server"></asp:TextBox>
    </div>
    <div class="ContentRow2">
    </div>
  </div> 
  <div class="FullRow1">
    <div class="ContentRow2">
    </div>
    <div class="ContentRow1">
        <asp:Label ID="Label5" runat="server" Text="Term Lease Date To:"></asp:Label>
    </div>
    <div class="ContentRow2">
        <asp:TextBox ID="txtToDate" CssClass="datepicker" runat="server"></asp:TextBox>
    </div>
    <div class="ContentRow2">
    </div>
  </div> 
 <div class="FullRow1">
    <div class="ContentRow2">
    </div>
    <div class="ContentRow1">
        <asp:Label ID="Label1" runat="server" Text="Landlord:"></asp:Label>
    </div>
    <div class="ContentRow2">
        <asp:DropDownList ID="ddLandlordID" runat="server" width = "200px" 
            AutoPostBack="True" DataSourceID="LandlordDataSource" DataTextField="Name" 
            DataValueField="ID" AppendDataBoundItems="True">
            <asp:ListItem Value="0">Please select landlord</asp:ListItem>
        </asp:DropDownList>
    </div>
    <div class="ContentRow2">
    </div>
  </div> 
  <div class="FullRow1">
    <div class="ContentRow2">
    </div>
    <div class="ContentRow1">
        <asp:Label ID="Label2" runat="server" Text="Address:" ></asp:Label>
    </div>
    <div class="ContentRow2">
        <asp:DropDownList ID="ddAddress" runat="server" width = "200px" 
            DataSourceID="AddressPropertyDataSource" DataTextField="Address" 
            DataValueField="ID" AutoPostBack="True" 
            >
         <asp:ListItem Value="0">Please select address</asp:ListItem>
        </asp:DropDownList>
    </div>
    <div class="ContentRow2">
    </div>
  </div> 
    <div class="FullRow1">
    <div class="ContentRow2">
    </div>
    <div class="ContentRow1">
        <asp:Label ID="Label3" runat="server" Text="Suite:"></asp:Label>
    </div>
    <div class="ContentRow2">
        <asp:DropDownList ID="ddSuite" runat="server" width = "200px" 
            DataSourceID="SuitePropertyDataSource" DataTextField="Suite" 
            DataValueField="ID" 
            >
              <asp:ListItem Value="0">Please select suite</asp:ListItem>
        </asp:DropDownList>
    </div>
    <div class="ContentRow2">
    </div>
  </div> 
  <div class="FullRow1">
    
     <div class="FormHeading">
            <strong><asp:Label ID="lblFirstLanguage" runat="server" Text="HOUSING HISTORY"></asp:Label></strong>
    </div>
  </div> 
   
  <div class="FullRow2"> 
  
      <asp:GridView ID="GridView1" runat="server" DataSourceID="ClientPropertyDataSource" 
          AutoGenerateColumns="False" width = "900px" AllowPaging="True" 
          DataKeyNames="ID">
          <Columns>
              <asp:CommandField ShowSelectButton="True" />
              <asp:ButtonField Text="Edit" CommandName="Update"   />
              <asp:BoundField DataField="ID" HeaderText="ID" SortExpression="ID" 
                  Visible="False" />
              <asp:BoundField DataField="FromDate" HeaderText="FromDate" 
                  SortExpression="FromDate" />
              <asp:BoundField DataField="ToDate" HeaderText="ToDate" 
                  SortExpression="ToDate" />
              <asp:BoundField DataField="Name" HeaderText="Landlord" SortExpression="Name" />
              <asp:BoundField DataField="Address" HeaderText="Address" 
                  SortExpression="Address" />
              <asp:BoundField DataField="Suite" HeaderText="Suite" SortExpression="Suite" />
          </Columns>
      </asp:GridView>
  
  </div>
  <asp:HiddenField ID="Client_ID" runat="server" />
  <div class="FullRow1">
  <center><asp:Label ID= "lblMsg" runat="server" Visible="false" ForeColor="Red"  /></center>
  </div>
  <div class="FullRow1">
     <hr/>
     <center><asp:Button ID="btnSave" runat="server" Text="Save" Width="83px" /><asp:Button ID="btnCancel" runat="server" Text="Cancel" Width="83px" /></center>
  </div>
    
  <br />

</div>

            <ww:wwDataBinder ID="wwDataBinder1" runat="server">
                <DataBindingItems>
                
                   
                    <ww:wwDataBindingItem ID="WwDataBindingItem1" runat="server" ControlId="txtFromDate" BindingMode="TwoWay" BindingSource="_data"  BindingSourceMember="FromDate">
                    </ww:wwDataBindingItem>
                     <ww:wwDataBindingItem ID="WwDataBindingItem2" runat="server" ControlId="txtToDate" BindingMode="TwoWay" BindingSource="_data"  BindingSourceMember="ToDate">
                    </ww:wwDataBindingItem>
                     <ww:wwDataBindingItem ID="WwDataBindingItem3" runat="server" ControlId="ddSuite" BindingMode="TwoWay" BindingSource="_data" BindingProperty="SelectedValue" BindingSourceMember="PropertyID" >
                    </ww:wwDataBindingItem>
                
                 
                
                    <ww:wwDataBindingItem runat="server" ControlId="GridView1">
                    </ww:wwDataBindingItem>
                
                 
                
                </DataBindingItems>
            </ww:wwDataBinder> 

    <asp:ObjectDataSource ID="ClientPropertyDataSource" runat="server" 
        SelectMethod="GetClientProperties" 
        TypeName="CupsApp.Service.CupsDomainService" EnablePaging="True">
        <SelectParameters>
            <asp:ControlParameter ControlID="Client_ID" Name="clientID" 
                PropertyName="Value" Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>

    <asp:ObjectDataSource ID="LandlordDataSource" runat="server" 
        SelectMethod="GetLandlords" TypeName="CupsApp.Service.CupsDomainService">
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="AddressPropertyDataSource" runat="server" 
        SelectMethod="GetDistinctAddressByLandlord" 
        TypeName="CupsApp.Service.CupsDomainService">
        <SelectParameters>
            <asp:ControlParameter ControlID="ddLandlordID" Name="landlordID" 
                PropertyName="SelectedValue" Type="Int32" 
                ConvertEmptyStringToNull="False" />
        </SelectParameters>
    </asp:ObjectDataSource>
     <asp:ObjectDataSource ID="SuitePropertyDataSource" runat="server" 
        SelectMethod="GetPropertyByLandlord" 
        TypeName="CupsApp.Service.CupsDomainService">
        <SelectParameters>
            <asp:ControlParameter ControlID="ddLandlordID" Name="landlordID" 
                PropertyName="SelectedValue" Type="Int32" DefaultValue="0"/>
            <asp:ControlParameter ControlID="ddAddress" Name="address" 
                PropertyName="SelectedItem.Text" Type="String" DefaultValue ="" 
                ConvertEmptyStringToNull="False" />
        </SelectParameters>
    </asp:ObjectDataSource>

    <asp:ObjectDataSource ID="ObjectDataSource4" runat="server" 
        SelectMethod="GetClient" TypeName="CupsApp.Service.CupsDomainService">
         <SelectParameters>
            <asp:QueryStringParameter Name="id" QueryStringField="ClientID" Type="Int32"  />
    </SelectParameters>
    </asp:ObjectDataSource>

</asp:Content>

